//This class is for creating normal creatures that need to inherit the typical abilities
package com.sjsayers.jtbae.creatures;
import java.util.Random;
public class SuperCreature {
	private int health;
	private int strength;
	private int exp;
	private boolean isCreatureAlive = true;
	private int level;
	/**
	 * This is the constructor for setting up a creature.
	 * @param health This is the amount of health the creature will start with.
	 * @param strength This is the amount of strength the creature will start with.
	 * @param setExp This is the amount of experience the creature will start with.
	 */
	public SuperCreature(int health, int strength, int setExp){
		this.setExp(setExp);
		this.setHealth(health);
		this.setStrength(strength);
	}
	/**
	 * This is for taking damage on a creature
	 * @param decreaseValue the amount of damage you want to subtract from the creatures current health.
	 */
	public void decHealth (int decreaseValue){
		if(this.getHealth()>= 1){
			health -= decreaseValue;
			this.setCreatureLifeStatus(true);
		}
		else {
			this.setCreatureLifeStatus(false);
		}
	}
	/**
	 * This is for healing or raising the health on the current creature.
	 * @param increaseValue How much you would increase the health by.
	 */
	public void incHealth(int increaseValue){
		health += increaseValue;
	}
	/**
	 * this is for setting a health, good for resetting values or putting a generic health value in.
	 * @param setHealth What you would like the creatures health to be.
	 */
	public void setHealth(int setHealth){
		health = setHealth;
	}
	/**
	 * This is for finding out what the creatures current health is.
	 * @return the creatures current health.
	 */
	public int getHealth(){
		return health;
	}
	/**
	 * This is for finding out what the creatures current EXP is.
	 * @return the creatures current exp.
	 */
	public int getExp(){
		return exp;
	}
	/**
	 * for setting the creatures strength
	 * @param newValue what you want the creatures strength to be.
	 */
	public void setStrength(int newValue){
		strength = newValue;
	}
	
	/**
	 * for getting the creatures current strength
	 * @return the creatures strength
	 */
	public int getStrength(){
		return strength;
	}
	/**
	 * This is for setting the creature to be alive or dead, by default it is true.
	 * @param isAlive alive or dead true or false.
	 */
	public void setCreatureLifeStatus(boolean isAlive){
		isCreatureAlive = isAlive;
	}
	/**
	 * For finding out if the creature is alive
	 * @return the current status of the creature
	 */
	public boolean getCreatureLifeStatus(){
		return isCreatureAlive;
	}
	/**
	 * This is for combat, instead of just using their strength you create a hit damage between 1 and their strength, to make fights more interesting.
	 * @return a random number 1 between strength;
	 */
	public int getRandomDamage(){
		 Random r = new Random(); 
		 int randomDamage = r.nextInt(this.getStrength()) +1;
		 return randomDamage;
	}
	/**
	 * For setting the current creatures EXP count.
	 * @param setExp the EXP int you would like to set.
	 */
	public void setExp(int setExp){
		exp = setExp;
	}
	/**
	 * This is for setting the level of the current creature.
	 * @param newLevel what level you would like to set.
	 */
	public void setLevel(int newLevel){
		level = newLevel;
	}
	/**
	 * This will add on to the current creatures stats, making level up's help out.
	 */
	private void increaseStatsFromLevel(){
		strength = strength * level;
	}
	/**
	 * this is the level math, pretty simple.
	 */
	public void updateLevel(){
		if (exp <= 20){
			this.setLevel(1);
			increaseStatsFromLevel();
		}
		else if (exp <= 30){
			this.setLevel(2);
			increaseStatsFromLevel();
		}
		else if (exp <= 45){
			this.setLevel(3);
			increaseStatsFromLevel();
		}
		else if (exp <= 68){
			this.setLevel(4);
			increaseStatsFromLevel();
		}
		else if (exp <= 102){
			this.setLevel(5);
			increaseStatsFromLevel();
		}
	}
	/**
	 * For increasing the EXP after a fight.
	 * @param addExp how much extra exp you would like to add.
	 */
	public void incExp(int addExp){
		exp = exp + addExp;
	}

}
